package com.nuts.base.validation.constraints.validator;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

import com.nuts.base.validation.constraints.IsIdcard;

/**
 * 身份证校验器
 * @author 许自辉
 * @date 2017年9月20日
 */
public class IsIdcardValidator implements ConstraintValidator<IsIdcard, String> {
	
	@Override
	public void initialize(IsIdcard constraintAnnotation) {
	}

	@Override
	public boolean isValid(String value, ConstraintValidatorContext context) {
		IdcardValidator iv = new IdcardValidator();
		return iv.isValidatedAllIdcard(value);
	}
}